﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Arcanoid
{
    public class GameObject
    {
        public Texture2D Sprite { get; set; }

        public Vector2 Position;
        public Vector2 Velocity;  //speed

        public int Width
        {
            get { return Sprite.Width; }
        }

        public int Height
        {
            get { return Sprite.Height; }
        }

        public bool IsAlive { get; set; }

        public Rectangle Bounds
        {
            get { return new Rectangle((int) Position.X, (int) Position.Y, Width, Height); }
        }

        public void ReflectHorizontal()
        {
            Velocity.Y = -Velocity.Y;
        }

        public void ReflectVertical()
        {
            Velocity.X = -Velocity.X;
        }

        public GameObject(Texture2D sprite)
        {
            Sprite = sprite;
            IsAlive = true;
            Position = Vector2.Zero;
            Velocity = Vector2.Zero;
        }
    }
}
